

package com.yiyi.credit.manage.sso.mapper;

import com.yiyi.credit.manage.sso.common.mapper.CommonMapper;
import com.yiyi.credit.manage.sso.model.entity.SysUserInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;


public interface SysUserInfoMapper extends CommonMapper<SysUserInfo> {


    @Select("select ui.phone phone from sys_user_info ui  left JOIN sys_user_role ur on ui.uid=ur.user_id where ui.phone=#{phone} and ur.role_id=#{roleId} ")
    List<Map<String, Object>> checkPhone(@Param("phone") String phone, @Param("roleId") Long roleId);

    @Select("select ui.phone phone,ui.email email from sys_user_info ui  left JOIN sys_user u on ui.uid=u.id where u.user_name=#{userName} ")
    Map<String,String> getSysUserByUserName(@Param("userName") String userName);

    @Select("select email from sys_user_info where uid = (select id from sys_user where user_name = #{username})")
    String getEmailByUsername(@Param("username") String username);
}